//
//  BasicTVC.swift
//  微博
//
//  Created by King on 15/9/6.
//  Copyright © 2015年 King. All rights reserved.
//

import UIKit

class BasicTVC: UITableViewController, LoginViewControllerDelegate {
    
    var loginView: LoginViewController?

    override func viewDidLoad() {
        super.viewDidLoad()

    }
    
    
    
   let login = userAccount.userLogin
//    let login = false
    override func loadView() {

        
        login ? super.loadView() :setupLogin()
        
    }
    
    func setupLogin() {
    
        loginView = LoginViewController()
        loginView?.delegate = self
        view = loginView
        
        view.backgroundColor = UIColor(red: 237.0/255, green: 237.0/255, blue: 237.0/255, alpha: 1.0)
        
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: "loginViewWillRegistr")
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", style: UIBarButtonItemStyle.Plain, target: self, action: "loginViewWillLogin")

        
    }
    
    //MARK: - 实现协议方法
    func loginViewWillRegistr() {
    }
    
    func loginViewWillLogin() {
        let nav = UINavigationController(rootViewController: OAuthVC())

        presentViewController(nav, animated: true, completion: nil)
    }
   }
